<?php
/* @var $this PageController */
/* @var $model Page */
/* @var $form CActiveForm */
$request = Yii::app()->request;
if ($request->enableCsrfValidation) {
    echo CHtml::metaTag($request->getCsrfToken(), 'csrf-token');
    echo CHtml::metaTag($request->csrfTokenName, 'csrf-param');
}
?>

<div class="form">
    <?php $form = $this->beginWidget('CActiveForm', array(
    'id' => 'page-form',
    'enableAjaxValidation' => false,)); ?>

    <?php echo $form->errorSummary($model); ?>
    <table border="0" cellpadding="0" cellspacing="0" id="id-form">
        <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('top_halaman'); ?></th>
            <td class="idform">
                <?php echo $form->dropDownList($model, 'top_halaman', $pages, array(
                'empty' => '(Pilih Parent)',
                'style' => 'width:200px')); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('top_halaman')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'top_halaman', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <?php if ($model->isNewRecord && username() == "superadmin"): ?>
        <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('kategori_halaman'); ?></th>
            <td class="idform">
                <?php echo $form->dropDownList($model, 'kategori_halaman',
                array('0' => 'Non Aplikasi', '1' => 'Aplikasi'), array(
                    'empty' => '(Pilih tipe halaman)',
                    'style' => 'width:200px')); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('kategori_halaman')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'kategori_halaman', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <?php elseif ($model->isNewRecord && username() != "superadmin"): ?>
            <?php echo $form->hiddenField($model,'kategori_halaman',array('value'=> 0)); ?>
        <?php endif; ?>
        <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('nama_halaman'); ?></th>
            <td class="idform">
                <?php echo $form->textField($model, 'nama_halaman',
                array('size' => 60, 'maxlength' => 250)); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('nama_halaman')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'nama_halaman', array('class' => 'error-inner')); ?>
            </td>
        </tr>
      <!--  <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('page_name'); ?></th>
            <td class="idform">
                <?php echo $form->textField($model, 'page_name',
                array('size' => 60, 'maxlength' => 250)); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('page_name')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'page_name', array('class' => 'error-inner')); ?>
            </td>
        </tr>-->
        <?php if (!$model->isNewRecord && !$model->kategori_halaman): ?>
        <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('judul'); ?></th>
            <td class="idform">
                <?php echo $form->textField($model, 'judul',
                array('size' => 60, 'maxlength' => 250)); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('judul')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'judul', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('isi_halaman'); ?></th>
            <td class="idform">
                <?php $this->widget('ext.tinymce.TinyMce', array(
                'model' => $model,
                'attribute' => 'isi_halaman',
                'fileManager' => array(
                    'class' => 'ext.elFinder.TinyMceElFinder',
                    'connectorRoute' => 'elfinder/connector',),
                'htmlOptions' => array('rows' => 6, 'cols' => 60,),)); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('isi_halaman')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'isi_halaman', array('class' => 'error-inner')); ?>
            </td>
        </tr>
      <!--  <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('title'); ?></th>
            <td class="idform">
                <?php echo $form->textField($model, 'title',
                array('size' => 60, 'maxlength' => 250)); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('title')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'title', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('content'); ?></th>
            <td class="idform">
                <?php $this->widget('ext.tinymce.TinyMce', array(
                'model' => $model,
                'attribute' => 'content',
                'fileManager' => array(
                    'class' => 'ext.elFinder.TinyMceElFinder',
                    'connectorRoute' => 'elfinder/connector',),
                'htmlOptions' => array('rows' => 6, 'cols' => 60,),)); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('content')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'content', array('class' => 'error-inner')); ?>
            </td>
        </tr>-->
        <?php endif; ?>
        <?php if (!$model->isNewRecord && $model->kategori_halaman): ?>
        <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('file_include'); ?></th>
            <td class="idform">
                <?php echo $form->textField($model, 'file_include',
                array('size' => 60, 'maxlength' => 250)); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('file_include')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'file_include', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <?php endif; ?>
           <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('status'); ?></th>
            <td valign="top">    <?php echo $form->radioButtonList($model, 'status', array(0 => 'Non Aktif', 1 => 'Aktif'));
                ?>
            </td>
              <td class="idform">
                <?php if ($model->hasErrors('status')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'status', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <tr>
            <th>&nbsp;</th>
            <td valign="top">
               <?php echo CHtml::submitButton($model->isNewRecord ? 'Buat' : 'Simpan',array('class'=>'form-submit')); ?>
            </td>
            <td class="idform"></td>
        </tr>
    </table>
    <?php $this->endWidget(); ?>
</div><!-- form -->